﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
         
            Queue queue1 = new Queue();//遍历数组
            queue1.Enqueue("aaa");
            queue1.Enqueue("bbb");
            queue1.Enqueue("ccc");
            IEnumerator enumerator = queue1.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Console.WriteLine(enumerator.Current);
            }
            Console.WriteLine();
            Queue queue2 = new Queue();
            //排队买饭
            queue2.Enqueue("小刚");
            queue2.Enqueue("小明");
            queue2.Enqueue("小智");
            Console.WriteLine("开始排队买饭");
            while (queue2.Count != 0)
            {
                Console.WriteLine(queue2.Dequeue()+"已经买完饭");
            }
            Console.WriteLine("回宿舍");
        }
    }
}
